home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / IOInterface / deltaFont.dcl < prev    next >
Encoding:
Modula Definition  |  1997-04-23  |  2.4 KB  |  68 lines  |  [TEXT/3PRM]

  1. definition module deltaFont;
  2.  
  3. //    Version 0.8 to 1.0
  4.  
  5. //
  6. //    Operations on Fonts.
  7. //
  8.  
  9. /*
  10. ::    Font;
  11.  
  12. ::    FontName    :== String;
  13. ::    FontStyle    :==    String;
  14. ::    FontSize    :==    Int;
  15. ::    FontInfo    :==    (!Int, !Int, !Int, !Int);
  16.  
  17.  
  18. MinFontSize        :==    6;
  19. MaxFontSize        :==    128;
  20.  
  21.  
  22. SelectFont :: !FontName ![FontStyle] !FontSize -> (!Bool, !Font);
  23. /*    SelectFont creates the font as specified by the name, the stylistic
  24.     variations and size. In case there are no FontStyles ([]), the font
  25.     is selected without stylistic variations (i.e. in plain style).
  26.     The size is always adjusted between MinFontSize and MaxFontSize.
  27.     The boolean result is True in case this font is available and needn't
  28.     be scaled. In case the font is not available, the default font is
  29.     chosen in the indicated style and size. */
  30.  
  31. DefaultFont :: (!FontName, ![FontStyle], !FontSize);
  32. /*    DefaultFont returns name, style and size of the default font. */
  33.  
  34. FontNames    ::                -> [FontName];
  35. FontStyles    :: !FontName    -> [FontStyle];
  36. FontSizes    :: !FontName    -> [FontSize];
  37. /*    FontNames    returns the FontNames of all available fonts.
  38.     FontStyles    returns the FontStyles of all available styles.
  39.     FontSizes    returns all FontSizes of a font that are available without scaling.
  40.     In case the font is unavailable, the styles or sizes of the default font
  41.     are returned. */
  42.  
  43.  
  44. FontCharWidth    :: !Char        !Font -> Int;
  45. FontCharWidths    :: ![Char]        !Font -> [Int];
  46. FontStringWidth    :: !String        !Font -> Int;
  47. FontStringWidths:: ![String]    !Font -> [Int];
  48. /*    FontCharWidth(s) (FontStringWidth(s)) return the width(s) in terms of pixels
  49.     of given character(s) (string(s)) for a particular Font. */
  50.  
  51. FontMetrics :: !Font -> FontInfo;
  52. /*    FontMetrics yields the FontInfo in terms of pixels of a given Font. The FontInfo
  53.     is a four-tuple (ascent, descent, max width, leading) which defines the metrics
  54.     of a font:
  55.         - ascent    is the height of the top most character measured from the base
  56.         - descent    is the height of the bottom most character measured from the base
  57.         - max width    is the width of the widest character including spacing
  58.         - leading    is the vertical distance between two lines of the same font.
  59.     The full height of a line is the sum of the ascent, descent and leading. */
  60. */
  61.  
  62. from    font    import
  63.     Font, FontName, FontStyle, FontSize, FontInfo,
  64.     MinFontSize, MaxFontSize,
  65.     SelectFont, DefaultFont,
  66.     FontNames, FontStyles, FontSizes,
  67.     FontCharWidth, FontStringWidth, FontCharWidths, FontStringWidths, FontMetrics;
  68.